package com.etc.dao;

import com.etc.entity.Paid;
import com.etc.entity.Recordtime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

@Repository
public interface PaidDao extends JpaSpecificationExecutor<Paid>, JpaRepository<Paid, Integer>, Serializable {

    @Query(nativeQuery = true, value = "select * from Paid s where (((curdate() - interval ?1 day) < cast(s.buytime as date)) and (cast(s.buytime as date) <= (curdate() - interval 0 day)))")
    public List<Paid> findByday(Integer day);

}
